<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.4.js"></script>
<script type="text/javascript">
$(function() {
	$(".dragElement").css("width","50px");
	$(".dragElement").css("border","1px solid blue");
	$(".dragElement").css("float", "left");
	$(".dragElement").draggable({revert:"invalid"});

	$("#dropZone").css("clear","left");
	$("#dropZone").css("width","250px");
	$("#dropZone").css("height","150px");
	$("#dropZone").css("border","2px solid green");
	$("#dropZone").droppable(
		{
			drop:function(event, ui){
				$(ui.draggable[0]).css("top","0px");
				$(ui.draggable[0]).css("left","0px");
				$(this).append(ui.draggable[0]);
			}
		}
	);

	$("#annuler").click(function(){
		objets = $("#dropZone div").get();
		for(i = 0 ; i < objets.length ; i++) {
			$("#containerDraggableElements").append(objets[i]);
		}
	});
	
});

</script>

</head>
<body>
<div id="containerDraggableElements">
	<div class="dragElement">elem 1</div>
	<div class="dragElement">elem 2</div>
	<div class="dragElement">elem 3</div>
	<div class="dragElement">elem 4</div>
</div>
<div style="margin-top: 15px"  id="dropZone"></div>
<input type="button" id="annuler" value="annuler drop" />


</body>
</html>